﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace Simple.Common.Uow.Uow
{
    public interface IUnitOfWork : IAsyncDisposable
    {
        /// <summary>
        /// Appends the database context.
        /// </summary>
        /// <param name="dbContext">The database context.</param>
        Task AppendDbContext(DbContext dbContext);

        Task AppendDbContext(List<DbContext> dbContexts);

        #region Commit
        Task CommitAsync();
        #endregion Commit

        #region ExecuteSqlCommand

        Task<int> ExecuteSqlRawAsync<TDbContext>(string sql) where TDbContext : DbContext;

        Task<int> ExecuteSqlRawAsync<TDbContext>(string sql, params object[] parameters) where TDbContext : DbContext;


        #endregion ExecuteSqlCommand
    }
}
